export default class Loading extends Sprite {

  constructor() {
    super();
  
    this.init();
  }

  init() {

    //黑色背景
		this.bg = new Sprite();
		this.bg.graphics.drawRect(0, 0, Config.deviceWidth, Config.deviceHeight, '#000000');
		this.addChild(this.bg);

		//loading文本
		this.txt = new Text();
		this.txt.color = '#FFFFFF';
		this.txt.fontSize = 30;
		this.txt.text = 'Loading ';
		this.txt.width = Config.deviceWidth;
    this.txt.align = 'center';
    this.txt.y = (Config.deviceHeight - this.txt.height) / 2;// 垂直居中实现
		this.addChild(this.txt);
  }

  progress(value) {
    this.txt.text = 'Loading ' + parseInt(value * 100) + '%';
  }
}